package com.database.mapper;


import com.database.character.Attention;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface AttentionMapper {

  //添加关注
  @Insert("insert into attention(user_id, focused_id) values (#{userId}, #{focusedId})")
  int addAttention(Attention attention);

  //取消关注
  @Delete("delete from attention where focused_id = #{focusedId}")
  int deleteAttentionByFocusedId(Integer focusedId);

  //根据focusedId查询关注
  @Select("select * from attention where focused_id = #{focusedId}")
  Attention getAttentionByFocusedId(Integer focusedId);

  //根据userId查询关注
  @Select("select * from attention where user_id = #{userId}")
  List<Attention> getAttentionByUid(Integer userId);
}
